/**
 * https://github.com/bpmn-io/bpmn-js-i18n/blob/main/translations/zn.js
 */
const translations = {
    //
    "Activate create/remove space tool": "启动创建/删除空间工具",
    "Activate global connect tool": "启动全局连接工具",
    "Activate hand tool": "启动手动工具",
    "Activate lasso tool": "启动 Lasso 工具",
    "Ad-hoc": "Ad-hoc子流程",
    "Add lane above": "添加到通道之上",
    "Add lane below": "添加到通道之下",
    "Append compensation activity": "追加补偿活动",
    "Append conditional intermediate catch event": "添加中间条件捕获事件",
    "Append end event": "添加结束事件",
    "Append gateway": "添加网关",
    "Append intermediate/boundary event": "添加中间/边界事件",
    "Append message intermediate catch event": "添加消息中间捕获事件",
    "Append receive task": "添加接收任务",
    "Append signal intermediate catch event": "添加信号中间捕获事件",
    "Append task": "添加任务",
    "Append timer intermediate catch event": "添加定时器中间捕获事件",
    "Business rule task": "规则任务",
    "Call activity": "引用流程",
    "Cancel boundary event": "取消边界事件",
    "Cancel end event": "取消结束事件",
    "Change type": "更改类型",
    "Collection": "集合",
    "Compensation boundary event": "补偿边界事件",
    "Compensation end event": "结束补偿事件",
    "Compensation intermediate throw event": "中间补偿抛出事件",
    "Compensation start event": "补偿启动事件",
    "Complex gateway": "复杂网关",
    "Conditional boundary event": "条件边界事件",
    "Conditional boundary event (non-interrupting)": "条件边界事件 (非中断)",
    "Conditional flow": "条件流",
    "Conditional intermediate catch event": "中间条件捕获事件",
    "Conditional start event": "条件启动事件",
    "Conditional start event (non-interrupting)": "条件启动事件 (非中断)",
    "Connect using association": "文本关联",
    "Connect using data input association": "数据关联",
    "Connect using sequence/message flow or association": "消息关联",
    "Create data object reference": "创建数据对象引用",
    "Create data store reference": "创建数据存储引用",
    "Create end event": "创建结束事件",
    "Create expanded sub-process": "创建可折叠子流程",
    "Create gateway": "创建网关",
    "Create group": "创建组",
    "Create intermediate/boundary event": "创建中间/边界事件",
    "Create pool/participant": "创建池/参与者",
    "Create start event": "创建开始事件",
    "Create task": "创建任务",
    "Data object reference": "数据对象引用",
    "Data store reference": "数据存储引用",
    "Default flow": "默认流",
    "Divide into three lanes": "分成三条通道",
    "Divide into two lanes": "分成两条通道",
    "Empty pool/participant": "空泳道",
    "Empty pool/participant (removes content)": "清空泳道（删除内容）",
    "End event": "结束事件",
    "Error boundary event": "错误边界事件",
    "Error end event": "结束错误事件",
    "Error start event": "错误启动事件",
    "Escalation boundary event": "升级边界事件",
    "Escalation boundary event (non-interrupting)": "升级边界事件 (非中断)",
    "Escalation end event": "结束升级事件",
    "Escalation intermediate throw event": "中间升级抛出事件",
    "Escalation start event": "升级启动事件",
    "Escalation start event (non-interrupting)": "升级启动事件 (非中断)",
    "Event sub-process": "事件子流程",
    "Event-based gateway": "事件网关",
    "Exclusive gateway": "独占网关",
    "Inclusive gateway": "包容网关",
    "Intermediate throw event": "中间抛出事件",
    "Link intermediate catch event": "中间链接捕获事件",
    "Link intermediate throw event": "中间链接抛出事件",
    "Loop": "循环",
    "Manual task": "手动任务",
    "Message boundary event": "消息边界事件",
    "Message boundary event (non-interrupting)": "消息边界事件 (非中断)",
    "Message end event": "结束消息事件",
    "Message intermediate catch event": "中间消息捕获事件",
    "Message intermediate throw event": "中间消息抛出事件",
    "Message start event": "消息启动事件",
    "Message start event (non-interrupting)": "消息启动事件 (非中断)",
    "Parallel gateway": "并行网关",
    "Parallel multi-instance": "并行多实例",
    "Participant multiplicity": "参与者多重性",
    "Receive task": "接受任务",
    "Remove": "移除",
    "Script task": "脚本任务",
    "Send task": "发送任务",
    "Sequence flow": "顺序流",
    "Sequential multi-instance": "串行多实例",
    "Service task": "服务任务",
    "Signal boundary event": "信号边界事件",
    "Signal boundary event (non-interrupting)": "信号边界事件 (非中断)",
    "Signal end event": "结束信号事件",
    "Signal intermediate catch event": "中间信号捕获事件",
    "Signal intermediate throw event": "中间信号抛出事件",
    "Signal start event": "信号启动事件",
    "Signal start event (non-interrupting)": "信号启动事件 (非中断)",
    "Start event": "开始事件",
    "Sub-process": "子流程",
    "Sub-process (collapsed)": "可折叠子流程",
    "Sub-process (expanded)": "可展开子流程",
    "Task": "任务",
    "Terminate end event": "终止边界事件",
    "Timer boundary event": "定时边界事件",
    "Timer boundary event (non-interrupting)": "定时边界事件 (非中断)",
    "Timer intermediate catch event": "中间定时捕获事件",
    "Timer start event": "定时启动事件",
    "Timer start event (non-interrupting)": "定时启动事件 (非中断)",
    "Transaction": "事务",
    "User task": "用户任务",
    "already rendered {element}": "{element} 已呈现",
    "correcting missing bpmnElement on {plane} to {rootElement}": "在 {plane} 上更正缺失的 bpmnElement 为 {rootElement}",
    "diagram not part of bpmn:Definitions": "图表不是 bpmn:Definitions 的一部分",
    "element required": "需要元素",
    "element {element} referenced by {referenced}#{property} not yet drawn": "元素 {element} 的引用 {referenced}#{property} 尚未绘制",
    "failed to import {element}": "{element} 导入失败",
    "flow elements must be children of pools/participants": "元素必须是池/参与者的子级",
    "missing {semantic}#attachedToRef": "在 {element} 中缺少 {semantic}#attachedToRef",
    "more than {count} child lanes": "超过 {count} 条通道",
    "multiple DI elements defined for {element}": "为 {element} 定义了多个 DI 元素",
    "no bpmnElement referenced in {element}": "{element} 中没有引用 bpmnElement",
    "no diagram to display": "没有要显示的图表",
    "no parent for {element} in {parent}": "在 {element} 中没有父元素 {parent}",
    "no process or collaboration to display": "没有可显示的流程或协作",
    "no shape type specified": "未指定形状类型",
    "out of bounds release": "越界释放",

    // Labels
    'Activate the global connect tool': '激活全局连接工具',
    'Append {type}': '追加 {type}',
    'Append EndEvent': '追加 结束事件 ',
    'Append Task': '追加 任务',
    'Append Gateway': '追加 网关',
    'Append Intermediate/Boundary Event': '追加 中间/边界 事件',
    'Add Lane above': '在上面添加道',
    'Divide into two Lanes': '分割成两个道',
    'Divide into three Lanes': '分割成三个道',
    'Add Lane below': '在下面添加道',
    'Connect using Association': '使用关联连接',
    'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接',
    'Connect using DataInputAssociation': '使用数据输入关联连接',
    'Activate the hand tool': '激活抓手工具',
    'Activate the lasso tool': '激活套索工具',
    'Activate the create/remove space tool': '激活创建/删除空间工具',
    'Create expanded SubProcess': '创建扩展子过程',
    'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件',
    'Create Pool/Participant': '创建池/参与者',
    'Parallel Multi Instance': '并行多重事件',
    'Sequential Multi Instance': '时序多重事件',
    'DataObjectReference': '数据对象参考',
    'DataStoreReference': '数据存储参考',
    'Create {type}': '创建 {type}',
    'Create Task': '创建任务',
    'Create StartEvent': '创建开始事件',
    'Create EndEvent': '创建结束事件',
    'Create Group': '创建组',
    'Send Task': '发送任务',
    'Receive Task': '接收任务',
    'User Task': '用户任务',
    'Manual Task': '手工任务',
    'Business Rule Task': '业务规则任务',
    'Service Task': '服务任务',
    'Script Task': '脚本任务',
    'Call Activity': '调用活动',
    'Sub Process (collapsed)': '子流程（折叠的）',
    'Sub Process (expanded)': '子流程（展开的）',
    'Start Event': '开始事件',
    'StartEvent': '开始事件',
    'Intermediate Throw Event': '中间事件',
    'End Event': '结束事件',
    'EndEvent': '结束事件',
    'Create Gateway': '创建网关',
    'GateWay': '网关',
    'Create Intermediate/Boundary Event': '创建中间/边界事件',
    'Message Start Event': '消息开始事件',
    'Timer Start Event': '定时开始事件',
    'Conditional Start Event': '条件开始事件',
    'Signal Start Event': '信号开始事件',
    'Error Start Event': '错误开始事件',
    'Escalation Start Event': '升级开始事件',
    'Compensation Start Event': '补偿开始事件',
    'Message Start Event (non-interrupting)': '消息开始事件（非中断）',
    'Timer Start Event (non-interrupting)': '定时开始事件（非中断）',
    'Conditional Start Event (non-interrupting)': '条件开始事件（非中断）',
    'Signal Start Event (non-interrupting)': '信号开始事件（非中断）',
    'Escalation Start Event (non-interrupting)': '升级开始事件（非中断）',
    'Message Intermediate Catch Event': '消息中间捕获事件',
    'Message Intermediate Throw Event': '消息中间抛出事件',
    'Timer Intermediate Catch Event': '定时中间捕获事件',
    'Escalation Intermediate Throw Event': '升级中间抛出事件',
    'Conditional Intermediate Catch Event': '条件中间捕获事件',
    'Link Intermediate Catch Event': '链接中间捕获事件',
    'Link Intermediate Throw Event': '链接中间抛出事件',
    'Compensation Intermediate Throw Event': '补偿中间抛出事件',
    'Signal Intermediate Catch Event': '信号中间捕获事件',
    'Signal Intermediate Throw Event': '信号中间抛出事件',
    'Message End Event': '消息结束事件',
    'Escalation End Event': '定时结束事件',
    'Error End Event': '错误结束事件',
    'Cancel End Event': '取消结束事件',
    'Compensation End Event': '补偿结束事件',
    'Signal End Event': '信号结束事件',
    'Terminate End Event': '终止结束事件',
    'Message Boundary Event': '消息边界事件',
    'Message Boundary Event (non-interrupting)': '消息边界事件（非中断）',
    'Timer Boundary Event': '定时边界事件',
    'Timer Boundary Event (non-interrupting)': '定时边界事件（非中断）',
    'Escalation Boundary Event': '升级边界事件',
    'Escalation Boundary Event (non-interrupting)': '升级边界事件（非中断）',
    'Conditional Boundary Event': '条件边界事件',
    'Conditional Boundary Event (non-interrupting)': '条件边界事件（非中断）',
    'Error Boundary Event': '错误边界事件',
    'Cancel Boundary Event': '取消边界事件',
    'Signal Boundary Event': '信号边界事件',
    'Signal Boundary Event (non-interrupting)': '信号边界事件（非中断）',
    'Compensation Boundary Event': '补偿边界事件',
    'Exclusive Gateway': '互斥网关',
    'Parallel Gateway': '并行网关',
    'Inclusive Gateway': '相容网关',
    'Complex Gateway': '复杂网关',
    'Event based Gateway': '事件网关',
    'Sub Process': '子流程',
    'Event Sub Process': '事件子流程',
    'Collapsed Pool': '折叠池',
    'Expanded Pool': '展开池',
    //属性面板的参数
    'Id': '编号',
    'Name': '名称',
    'General': '常规',
    'Details': '详情',
    'Message Name': '消息名称',
    'Message': '消息',
    'Initiator': '创建者',
    'Asynchronous Continuations': '持续异步',
    'Asynchronous Before': '异步前',
    'Asynchronous After': '异步后',
    'Job Configuration': '工作配置',
    'Exclusive': '排除',
    'Job Priority': '工作优先级',
    'Retry Time Cycle': '重试时间周期',
    'Documentation': '文档',
    'Element Documentation': '元素文档',
    'History Configuration': '历史配置',
    'History Time To Live': '历史的生存时间',
    'Forms': '表单',
    'Form Key': '表单key',
    'Form Fields': '表单字段',
    'Business Key': '业务key',
    'Form Field': '表单字段',
    'ID': '编号',
    'Type': '类型',
    'Label': '名称',
    'Default Value': '默认值',
    'Validation': '校验',
    'Add Constraint': '添加约束',
    'Config': '配置',
    'Properties': '属性',
    'Add Property': '添加属性',
    'Value': '值',
    'Add': '添加',
    'Values': '值',
    'Add Value': '添加值',
    'Listeners': '监听器',
    'Execution Listener': '执行监听',
    'Event Type': '事件类型',
    'Listener Type': '监听器类型',
    'Java Class': 'Java类',
    'Expression': '表达式',
    'Must provide a value': '必须提供一个值',
    'Delegate Expression': '代理表达式',
    'Script': '脚本',
    'Script Format': '脚本格式',
    'Script Type': '脚本类型',
    'Inline Script': '内联脚本',
    'External Script': '外部脚本',
    'Resource': '资源',
    'Field Injection': '字段注入',
    'Extensions': '扩展',
    'Input/Output': '输入/输出',
    'Input Parameters': '输入参数',
    'Output Parameters': '输出参数',
    'Parameters': '参数',
    'Output Parameter': '输出参数',
    'Timer Definition Type': '定时器定义类型',
    'Timer Definition': '定时器定义',
    'Date': '日期',
    'Duration': '持续',
    'Cycle': '循环',
    'Signal': '信号',
    'Signal Name': '信号名称',
    'Escalation': '升级',
    'Error': '错误',
    'Link Name': '链接名称',
    'Condition': '条件名称',
    'Variable Name': '变量名称',
    'Variable Event': '变量事件',
    'Specify more than one variable change event as a comma separated list.': '多个变量事件以逗号隔开',
    'Wait for Completion': '等待完成',
    'Activity Ref': '活动参考',
    'Version Tag': '版本标签',
    'Executable': '可执行文件',
    'External Task Configuration': '扩展任务配置',
    'Task Priority': '任务优先级',
    'External': '外部',
    'Connector': '连接器',
    'Must configure Connector': '必须配置连接器',
    'Connector Id': '连接器编号',
    'Implementation': '实现方式',
    'Field Injections': '字段注入',
    'Fields': '字段',
    'Result Variable': '结果变量',
    'Topic': '主题',
    'Configure Connector': '配置连接器',
    'Input Parameter': '输入参数',
    'Assignee': '代理人',
    'Candidate Users': '候选用户',
    'Candidate Groups': '候选组',
    'Due Date': '到期时间',
    'Follow Up Date': '跟踪日期',
    'Priority': '优先级',
    'The follow up date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)': '跟踪日期必须符合EL表达式，如： ${someDate} ,或者一个ISO标准日期，如：2015-06-26T09:54:00',
    'The due date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)': '跟踪日期必须符合EL表达式，如： ${someDate} ,或者一个ISO标准日期，如：2015-06-26T09:54:00',
    'Variables': '变量',
    'Candidate Starter Configuration': '候选开始配置',
    'Task Listener': '任务监听器',
    'Candidate Starter Groups': '候选开始组',
    'Candidate Starter Users': '候选开始用户',
    'Tasklist Configuration': '任务列表配置',
    'Startable': '启动',
    'Specify more than one group as a comma separated list.': '指定多个组,用逗号分隔',
    'Specify more than one user as a comma separated list.': '指定多个用户,用逗号分隔',
    'This maps to the process definition key.': '这会映射为流程定义的键',
    'CallActivity Type': '调用活动类型',
    'Condition Type': '条件类型',
    'Create UserTask': '创建用户任务',
    'Create CallActivity': '创建调用活动',
    'Called Element': '调用元素',
    'Create DataObjectReference': '创建数据对象引用',
    'Create DataStoreReference': '创建数据存储引用',
    'Multi Instance': '多实例',
    'Loop Cardinality': '实例数量',
    'Element Variable': '元素变量',
    'Completion Condition': '完成条件',
    'Open minimap': '打开小地图',
    'Close minimap': '关闭小地图'
};

const translate = (template, replacements) => {
    replacements = replacements || {};
    template = translations[template] || template;
    return template.replace(/{([^}]+)}/g, (_, key) => {
        return replacements[key] || '{' + key + '}';
    });
}

